#include <Eigen/Dense>

#include <iostream>

using namespace Eigen;
using namespace std;


// output the length of the diagonal of the bounding box
void outputRange(const Eigen::MatrixXd & Mat) {
	Eigen::VectorXd minBounding = Mat.colwise().minCoeff();
	Eigen::VectorXd MaxBounding = Mat.colwise().maxCoeff();
	std::cout << "The max is " << MaxBounding << std::endl;
	std::cout << "The min is " << minBounding << std::endl;
	return;
}

// output the length of the diagonal of the bounding box
void outputModelLength(const Eigen::MatrixXd & Vertices) {
	Eigen::Vector3d minBoundingBoxPoint = Vertices.colwise().minCoeff();
	Eigen::Vector3d MaxBoundingBoxPoint = Vertices.colwise().maxCoeff();
	double modelSize = (MaxBoundingBoxPoint - minBoundingBoxPoint).norm();
	std::cout << "The diagonal of the bounding box of the model is " << modelSize << std::endl;
	return;
}

void outputModelinfo(const Eigen::MatrixXd Vertices, const Eigen::MatrixXi Faces) {
	unsigned int vRows = Vertices.rows();
	unsigned int fRows = Faces.rows();
	unsigned int fCols = Faces.cols();
	std::cout << "Vertices Number: " << vRows << endl;
	std::cout << "Faces Number: " << fRows << endl;
	std::cout << "Face col size: " << fCols << endl;

	bool *isInMesh = new bool[vRows + 10];
	memset(isInMesh, 0, vRows + 10);
	std::cout << "Flag array" << std::endl;

	unsigned int vNum;
	for (int i = 0; i < Faces.rows(); ++i) {
		for (int j = 0; j < fCols; ++j) {
			vNum = Faces(i, j);
			isInMesh[vNum] = true;
		}
	}
	std::cout << "Traverse" << std::endl;

	unsigned int nonMentioned = 0;
	for (int i = 0; i < vRows; ++i) {
		if (isInMesh[i] == false)nonMentioned++;
	}
	std::cout << "There is " << nonMentioned << " vertices non mentioned" << std::endl;
}